//Copyright (C) 1998-2008, Sumisho Computer Systems Corp. All Rights Reserved.

//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at

//http://www.apache.org/licenses/LICENSE-2.0

//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.

/**
 * @author Hitoshi Okada
 */

package com.curlap.orb.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

//import org.apache.commons.logging.Log;
//import org.apache.commons.logging.LogFactory;


/**
 * InstanceManagementServlet
 */
public abstract class InstanceManagementServlet extends HttpServlet
{
	private static final long serialVersionUID = 1L;

    // reserved strings
    public final static String REQUEST_OBJECT = "com.curlap.orb.servlet.internal-request-object";
    public final static String RESPONSE_OBJECT = "com.curlap.orb.servlet.internal-response-object";
    public final static String STREAM_RESPONSE = "com.curlap.orb.servlet.internal-stream-response";
    
//    private final Log log = LogFactory.getLog(InstanceManagementServlet.class);

    @Override
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException
    {
        final CurlConfig config = (CurlConfigFactory.getInstance(getServletContext())).getCurlConfig();
        HttpSession session = request.getSession(false);
        if(session == null && !config.enabledOnlyApplicationContext())
            session = request.getSession(true);
        response.setCharacterEncoding("UTF-8");
        response.setContentType("application/octet-stream; charset=\"UTF-8\"");
    }

    // NOTE: accept only POST request.
//  @Override
//  public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException
//  {
//  doPost(request, response);
//  }
}
